<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: User
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (U)</a> &raquo; 
    
    
    <span class="title">User</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: User
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">ActiveRecord::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveRecord::Base</li>
          
            <li class="next">User</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">app/models/user.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
ELMO - Secure, robust, and versatile data collection. Copyright 2011 The
Carter Center
</p>
<p>
ELMO is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
</p>
<p>
ELMO is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with ELMO. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</p>


  </div>
</div>
<div class="tags">
  

</div>

  
  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#reset_password_method-instance_method" title="#reset_password_method (instance method)">- (Object) <strong>reset_password_method</strong> </a>
    

    
  </span>
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
  </ul>



  

  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default-class_method" title="default (class method)">+ (Object) <strong>default</strong>(params = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default_eager-class_method" title="default_eager (class method)">+ (Object) <strong>default_eager</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#find_by_credentials-class_method" title="find_by_credentials (class method)">+ (Object) <strong>find_by_credentials</strong>(login, password) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#new_with_login_and_password-class_method" title="new_with_login_and_password (class method)">+ (Object) <strong>new_with_login_and_password</strong>(params) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#per_page-class_method" title="per_page (class method)">+ (Object) <strong>per_page</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#query_fragment-class_method" title="query_fragment (class method)">+ (Object) <strong>query_fragment</strong>(field, term) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
returns the lhs, operator, and rhs of a query fragment with the given field
and term.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#random_password-class_method" title="random_password (class method)">+ (Object) <strong>random_password</strong>(size = 6) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#search_examples-class_method" title="search_examples (class method)">+ (Object) <strong>search_examples</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#search_fields-class_method" title="search_fields (class method)">+ (Object) <strong>search_fields</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
gets the list of fields to be searched for this class includes whether they
should be included in a default, unqualified search and whether they are
searchable by a regular expression.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#select_options-class_method" title="select_options (class method)">+ (Object) <strong>select_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted-class_method" title="sorted (class method)">+ (Object) <strong>sorted</strong>(params) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#can_get_sms%3F-instance_method" title="#can_get_sms? (instance method)">- (Boolean) <strong>can_get_sms?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#deliver_intro%21-instance_method" title="#deliver_intro! (instance method)">- (Object) <strong>deliver_intro!</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#deliver_password_reset_instructions%21-instance_method" title="#deliver_password_reset_instructions! (instance method)">- (Object) <strong>deliver_password_reset_instructions!</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#full_name-instance_method" title="#full_name (instance method)">- (Object) <strong>full_name</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#is_observer%3F-instance_method" title="#is_observer? (instance method)">- (Boolean) <strong>is_observer?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#is_program_staff%3F-instance_method" title="#is_program_staff? (instance method)">- (Boolean) <strong>is_program_staff?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#phone_number-instance_method" title="#phone_number (instance method)">- (Object) <strong>phone_number</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
def generate_login!.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#reset_password-instance_method" title="#reset_password (instance method)">- (Object) <strong>reset_password</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#reset_password_if_requested-instance_method" title="#reset_password_if_requested (instance method)">- (Object) <strong>reset_password_if_requested</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_vcf-instance_method" title="#to_vcf (instance method)">- (Object) <strong>to_vcf</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  
  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id="reset_password_method=-instance_method"></span>
      <span id="reset_password_method-instance_method"></span>
      <div class="method_details first">
  <p class="signature first" id="reset_password_method-instance_method">
  
    - (<tt>Object</tt>) <strong>reset_password_method</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


120
121
122</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 120</span>

<span class='def def kw'>def</span> <span class='reset_password_method identifier id'>reset_password_method</span>
  <span class='@reset_password_method ivar id'>@reset_password_method</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span> <span class='integer val'>? </span><span class='string val'>&quot;dont&quot;</span> <span class='colon op'>:</span> <span class='@reset_password_method ivar id'>@reset_password_method</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="default-class_method">
  
    + (<tt>Object</tt>) <strong>default</strong>(params = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 53</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default identifier id'>default</span><span class='lparen token'>(</span><span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='User constant id'>User</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='lbrace token'>{</span><span class='symbol val'>:active</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='comma token'>,</span> <span class='symbol val'>:language_id</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='Language constant id'>Language</span><span class='dot token'>.</span><span class='english identifier id'>english</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='merge identifier id'>merge</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="default_eager-class_method">
  
    + (<tt>Object</tt>) <strong>default_eager</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 70</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default_eager identifier id'>default_eager</span>
  <span class='lbrack token'>[</span><span class='symbol val'>:language</span><span class='comma token'>,</span> <span class='symbol val'>:role</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="find_by_credentials-class_method">
  
    + (<tt>Object</tt>) <strong>find_by_credentials</strong>(login, password) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


65
66
67
68</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 65</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='find_by_credentials identifier id'>find_by_credentials</span><span class='lparen token'>(</span><span class='login identifier id'>login</span><span class='comma token'>,</span> <span class='password identifier id'>password</span><span class='rparen token'>)</span>
  <span class='user identifier id'>user</span> <span class='assign token'>=</span> <span class='find_by_login identifier id'>find_by_login</span><span class='lparen token'>(</span><span class='login identifier id'>login</span><span class='rparen token'>)</span>
  <span class='lparen token'>(</span><span class='user identifier id'>user</span> <span class='andop op'>&amp;&amp;</span> <span class='user identifier id'>user</span><span class='dot token'>.</span><span class='valid_password? fid id'>valid_password?</span><span class='lparen token'>(</span><span class='password identifier id'>password</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='user identifier id'>user</span> <span class='colon op'>:</span> <span class='nil nil kw'>nil</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="new_with_login_and_password-class_method">
  
    + (<tt>Object</tt>) <strong>new_with_login_and_password</strong>(params) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


56
57
58
59
60</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 56</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='new_with_login_and_password identifier id'>new_with_login_and_password</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span>
  <span class='u identifier id'>u</span> <span class='assign token'>=</span> <span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span>
  <span class='u identifier id'>u</span><span class='dot token'>.</span><span class='reset_password identifier id'>reset_password</span>
  <span class='u identifier id'>u</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="per_page-class_method">
  
    + (<tt>Object</tt>) <strong>per_page</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


42
43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 42</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='per_page identifier id'>per_page</span>
  <span class='comment val'># we want all of these on one page for now</span>
  <span class='integer val'>10000000</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="query_fragment-class_method">
  
    + (<tt>Object</tt>) <strong>query_fragment</strong>(field, term) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
returns the lhs, operator, and rhs of a query fragment with the given field
and term
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


87
88
89</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 87</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='query_fragment identifier id'>query_fragment</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='term identifier id'>term</span><span class='rparen token'>)</span>
  <span class='lbrack token'>[</span><span class='search_fields identifier id'>search_fields</span><span class='lbrack token'>[</span><span class='field identifier id'>field</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='symbol val'>:colname</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='string val'>&quot;like&quot;</span><span class='comma token'>,</span> <span class='dstring node'>&quot;%#{term}%&quot;</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="random_password-class_method">
  
    + (<tt>Object</tt>) <strong>random_password</strong>(size = 6) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


61
62
63
64</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 61</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='random_password identifier id'>random_password</span><span class='lparen token'>(</span><span class='size identifier id'>size</span> <span class='assign token'>=</span> <span class='integer val'>6</span><span class='rparen token'>)</span>
  <span class='charset identifier id'>charset</span> <span class='assign token'>=</span> <span class='dstring node'>%w{2 3 4 6 7 9 a c d e f g h j k m n p q r t v w x y z}</span>
  <span class='lparen token'>(</span><span class='integer val'>0</span><span class='dot3 op'>...</span><span class='size identifier id'>size</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='map identifier id'>map</span><span class='lbrace token'>{</span><span class='charset identifier id'>charset</span><span class='dot token'>.</span><span class='to_a identifier id'>to_a</span><span class='lbrack token'>[</span><span class='rand identifier id'>rand</span><span class='lparen token'>(</span><span class='charset identifier id'>charset</span><span class='dot token'>.</span><span class='size identifier id'>size</span><span class='rparen token'>)</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='join identifier id'>join</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="search_examples-class_method">
  
    + (<tt>Object</tt>) <strong>search_examples</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


91
92
93</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 91</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='search_examples identifier id'>search_examples</span>
  <span class='lbrack token'>[</span><span class='string val'>&quot;pinchy lombard&quot;</span><span class='comma token'>,</span> <span class='string val'>'role:observer'</span><span class='comma token'>,</span> <span class='string val'>&quot;language:english&quot;</span><span class='comma token'>,</span> <span class='string val'>&quot;phone:+44&quot;</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="search_fields-class_method">
  
    + (<tt>Object</tt>) <strong>search_fields</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
gets the list of fields to be searched for this class includes whether they
should be included in a default, unqualified search and whether they are
searchable by a regular expression
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


77
78
79
80
81
82
83
84</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 77</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='search_fields identifier id'>search_fields</span>
  <span class='lbrace token'>{</span><span class='symbol val'>:name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;users.name&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='symbol val'>:login</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;users.login&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='symbol val'>:language</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;languages.name&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='symbol val'>:role</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;roles.name&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='symbol val'>:email</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;users.email&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='symbol val'>:phone</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:colname</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;users.phone&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:default</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='comma token'>,</span> <span class='symbol val'>:regexp</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rbrace token'>}</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="select_options-class_method">
  
    + (<tt>Object</tt>) <strong>select_options</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 46</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='select_options identifier id'>select_options</span>
  <span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;name&quot;</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='u identifier id'>u</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='u identifier id'>u</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='u identifier id'>u</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted-class_method">
  
    + (<tt>Object</tt>) <strong>sorted</strong>(params) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


49
50
51
52</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 49</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span>
  <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='merge! fid id'>merge!</span><span class='lparen token'>(</span><span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;users.name&quot;</span><span class='rparen token'>)</span>
  <span class='paginate identifier id'>paginate</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="can_get_sms?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>can_get_sms?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


135</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 135</span>

<span class='def def kw'>def</span> <span class='can_get_sms? fid id'>can_get_sms?</span><span class='semicolon token'>;</span> <span class='notop op'>!</span><span class='phone identifier id'>phone</span><span class='dot token'>.</span><span class='blank? fid id'>blank?</span> <span class='andop op'>&amp;&amp;</span> <span class='phone_is_mobile identifier id'>phone_is_mobile</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="deliver_intro!-instance_method">
  
    - (<tt>Object</tt>) <strong>deliver_intro!</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


109
110
111
112</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 109</span>

<span class='def def kw'>def</span> <span class='deliver_intro! fid id'>deliver_intro!</span>
  <span class='reset_perishable_token! fid id'>reset_perishable_token!</span>
  <span class='Notifier constant id'>Notifier</span><span class='dot token'>.</span><span class='intro identifier id'>intro</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='deliver identifier id'>deliver</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="deliver_password_reset_instructions!-instance_method">
  
    - (<tt>Object</tt>) <strong>deliver_password_reset_instructions!</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


113
114
115
116</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 113</span>

<span class='def def kw'>def</span> <span class='deliver_password_reset_instructions! fid id'>deliver_password_reset_instructions!</span>
  <span class='reset_perishable_token! fid id'>reset_perishable_token!</span>
  <span class='Notifier constant id'>Notifier</span><span class='dot token'>.</span><span class='password_reset_instructions identifier id'>password_reset_instructions</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='deliver identifier id'>deliver</span>  
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="full_name-instance_method">
  
    - (<tt>Object</tt>) <strong>full_name</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 117</span>

<span class='def def kw'>def</span> <span class='full_name identifier id'>full_name</span>
  <span class='name identifier id'>name</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="is_observer?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>is_observer?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


137</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 137</span>

<span class='def def kw'>def</span> <span class='is_observer? fid id'>is_observer?</span><span class='semicolon token'>;</span> <span class='role identifier id'>role</span> <span class='integer val'>? </span><span class='role identifier id'>role</span><span class='dot token'>.</span><span class='is_observer? fid id'>is_observer?</span> <span class='colon op'>:</span> <span class='false false kw'>false</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="is_program_staff?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>is_program_staff?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


138</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 138</span>

<span class='def def kw'>def</span> <span class='is_program_staff? fid id'>is_program_staff?</span><span class='semicolon token'>;</span> <span class='role identifier id'>role</span> <span class='integer val'>? </span><span class='role identifier id'>role</span><span class='dot token'>.</span><span class='is_program_staff? fid id'>is_program_staff?</span> <span class='colon op'>:</span> <span class='false false kw'>false</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="phone_number-instance_method">
  
    - (<tt>Object</tt>) <strong>phone_number</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
def generate_login!
</p>
<pre class="code">
   <span class='base identifier id'>base</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;#{name.gsub(/[^A-Za-z]/,'')[0,1]}#{last_name.gsub(/[^A-Za-z]/,'')[0,7]}&quot;</span><span class='dot token'>.</span><span class='downcase identifier id'>downcase</span><span class='dot token'>.</span><span class='normalize identifier id'>normalize</span>
   <span class='try identifier id'>try</span> <span class='assign token'>=</span> <span class='integer val'>1</span>
   <span class='until until kw'>until</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='find_by_login identifier id'>find_by_login</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='login identifier id'>login</span> <span class='assign token'>=</span> <span class='base identifier id'>base</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='try identifier id'>try</span> <span class='gt op'>&gt;</span> <span class='integer val'>1</span> <span class='question op'>?</span> <span class='try identifier id'>try</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='colon op'>:</span> <span class='string val'>&quot;&quot;</span><span class='rparen token'>)</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
     <span class='try identifier id'>try</span> <span class='opasgn op'>+=</span> <span class='integer val'>1</span>
   <span class='end end kw'>end</span>
 <span class='end end kw'>end</span>
</pre>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


106
107
108</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 106</span>

<span class='def def kw'>def</span> <span class='phone_number identifier id'>phone_number</span>
  <span class='phone identifier id'>phone</span><span class='dot token'>.</span><span class='blank? fid id'>blank?</span> <span class='integer val'>? </span><span class='string val'>&quot;&quot;</span> <span class='colon op'>:</span> <span class='phone identifier id'>phone</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='phone_is_mobile? fid id'>phone_is_mobile?</span> <span class='integer val'>? </span><span class='string val'>&quot; [m]&quot;</span> <span class='colon op'>:</span> <span class='string val'>&quot;&quot;</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="reset_password-instance_method">
  
    - (<tt>Object</tt>) <strong>reset_password</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


95
96
97</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 95</span>

<span class='def def kw'>def</span> <span class='reset_password identifier id'>reset_password</span>
  <span class='self self kw'>self</span><span class='dot token'>.</span><span class='password identifier id'>password</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='password_confirmation identifier id'>password_confirmation</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='random_password identifier id'>random_password</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="reset_password_if_requested-instance_method">
  
    - (<tt>Object</tt>) <strong>reset_password_if_requested</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


123
124
125
126
127
128
129
130</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 123</span>

<span class='def def kw'>def</span> <span class='reset_password_if_requested identifier id'>reset_password_if_requested</span>
  <span class='if if kw'>if</span> <span class='dstring node'>%w[email print]</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span><span class='reset_password_method identifier id'>reset_password_method</span><span class='rparen token'>)</span>
    <span class='reset_password identifier id'>reset_password</span> <span class='and and kw'>and</span> <span class='save identifier id'>save</span>
  <span class='end end kw'>end</span>
  <span class='if if kw'>if</span> <span class='reset_password_method identifier id'>reset_password_method</span> <span class='eq op'>==</span> <span class='string val'>&quot;email&quot;</span>
    <span class='lparen token'>(</span><span class='login_count identifier id'>login_count</span> <span class='orop op'>||</span> <span class='integer val'>0</span><span class='rparen token'>)</span> <span class='gt op'>&gt;</span> <span class='integer val'>0</span> <span class='question op'>?</span> <span class='deliver_password_reset_instructions! fid id'>deliver_password_reset_instructions!</span> <span class='colon op'>:</span> <span class='deliver_intro! fid id'>deliver_intro!</span>
  <span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_vcf-instance_method">
  
    - (<tt>Object</tt>) <strong>to_vcf</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


131
132
133
134</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/user.rb', line 131</span>

<span class='def def kw'>def</span> <span class='to_vcf identifier id'>to_vcf</span>
  <span class='dstring node'>&quot;BEGIN:VCARD\nVERSION:3.0\nFN:#{name}\nEMAIL:#{email}\n&quot;</span> <span class='plus op'>+</span>
  <span class='lparen token'>(</span><span class='phone identifier id'>phone</span> <span class='integer val'>? </span><span class='dstring node'>&quot;TEL;TYPE=#{phone_is_mobile? ? 'CELL' : 'WORK'}:#{phone}\n&quot;</span> <span class='colon op'>:</span> <span class='string val'>&quot;&quot;</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='string val'>&quot;END:VCARD&quot;</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:18 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>